import 'package:flutter/material.dart';
import 'package:hello/douban/pages/main/bottom_bar.dart';
import 'package:hello/douban/pages/main/pages.dart';


class Main extends StatefulWidget {
  const Main({Key key}) : super(key: key);

  @override
  _MainState createState() => _MainState();
}

class _MainState extends State<Main> {
  int _currentIndex = 0;
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: IndexedStack(
        index: _currentIndex,
        children:pages,
      ),
      bottomNavigationBar: BottomNavigationBar(
        //超过四个隐藏文本
        currentIndex: _currentIndex,
        type: BottomNavigationBarType.fixed,
        items: initBottomItems(),
        onTap: (index){
          setState(() {
            _currentIndex = index;
          });
        },
      ),
    );
  }
}
